from UI.UI_askForm          import Ui_askOneEditWidget
from PyQt4                  import QtCore, QtGui

class AskFormEdit(QtGui.QDialog,Ui_askOneEditWidget,QtGui.QWidget):
    def __init__(self, labelName, buttonName):
        super(AskFormEdit,self).__init__()
        self.setupUi(self)
        self.initFields(labelName, buttonName)
        self.setEvents()
        
    def initFields(self,labelName, buttonName):
        self.customLabel.setText(labelName)
        if not buttonName:
            self.customPushButton.hide()
        else:
            self.customPushButton.setText(buttonName)
            
    def setEvents(self):
        self.customButtonBox.accepted.connect(self.acceptAskForm)
        self.customButtonBox.rejected.connect(self.rejectAskForm)
        
    def acceptAskForm(self):
        self.accept()
        
    def rejectAskForm(self):
        self.reject()